package com.cyd.adapter;

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.LayoutParams;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;

import com.cyd.adapter.RecyclerViewAdapter.OnItemClickListener;
import com.cyd.homefamily.R;

public class RecyclerViewHolder extends RecyclerView.ViewHolder implements
		OnClickListener {
	public ImageView mImg;
	public TextView mTitle;
	public TextView mMessage;
	private OnItemClickListener mOnItemClickListener;

	public RecyclerViewHolder(View view, OnItemClickListener listener) {
		super(view);
		RecyclerView.LayoutParams params = new RecyclerView.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
		view.setLayoutParams(params);
		view.setOnClickListener(this);
		this.mOnItemClickListener = listener;
		mImg = (ImageView) view.findViewById(R.id.img);
		mTitle = (TextView) view.findViewById(R.id.title);
		mMessage = (TextView) view.findViewById(R.id.message);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if (v != null)
			mOnItemClickListener.onItemClick(v, getPosition());
	}
}
